import 'dart:convert';

BaseModel loginModelFromJson(String str) => BaseModel.fromJson(json.decode(str));

String loginModelToJson(BaseModel data) => json.encode(data.toJson());

class BaseModel {
  int code;
  String ? msg;
  SearchData ? data;

  BaseModel({
    required this.code,
    this.msg,
    this.data,
  });

  factory BaseModel.fromJson(Map<String, dynamic> json) => BaseModel(
    code: json["code"],
    msg: json["msg"],
    data: json["data"] != null ? SearchData.fromJson(json["data"]) : null,
  );

  Map<String, dynamic> toJson() => {
    "code": code,
    "msg": msg,
    "data": data?.toJson(),
  };
}

class SearchData {
  String title;
  String heat;
  String link;

  SearchData({
    required this.title,
    required this.heat,
    required this.link,
  });

  factory SearchData.fromJson(Map<String, dynamic> json) => SearchData(
    title: json["title"],
    heat: json["heat"],
    link: json["link"]
  );

  Map<String, dynamic> toJson() => {
    "title": title,
    "heat": heat,
    "link": link
  };
}
